# coding:utf-8
# 有以下两个字典，请分别打印出两者的差异处(包括键和值)。

dict1 = {
  "pageSize": "30",
  "product": "EFund",
  "DISCOUNT": "",
  "SortColumn": "SYL_Y",
  "MobileKey": "4a69e1fc7d583fe671ad69c95ae6c2b7||945235770232353",
  "BUY": "true",
  "appType": "ttjj",
  "LevelOne": "",
  "version": "6.3.2",
  "onFundCache": "3",
  "Sort": "desc",
  "pageIndex": "1",
  "FundType": "6",
  "CompanyId": "",
  "plat": "Android",
  "TOPICAL": "",
  "ENDNAV": "",
  "LevelTwo": "",
  "ISABNORMAL": "true",
  "DataConstraintType": "0",
  "gToken": "ceaf-236567466abfda4e2864831ea5645231",
  "ESTABDATE": "6",
  "deviceid": "4a69e1fc7d583fe671ad69c95ae6c2b7||945235770232353"
}

dict2 = {
  "version": "6.3.2",
  "pageSize": "30",
  "product": "EFund",
  "DISCOUNT": "",
  "CLTYPE": "",
  "SortColumn": "SYL_Y",
  "MobileKey": "4a69e1fc7d583fe671ad69c95ae6c2b7||945235770232353",
  "BUY": "true",
  "appType": "ttjj",
  "RISKLEVEL": "",
  "igggggnoreburst": "true",
  "RLEVEL_SZ": "5,4,3",
  "Sort": "desc",
  "pageIndex": "1",
  "FundType": "0",
  "CompanyId": "",
  "plat": "Android",
  "TOPICAL": "",
  "ENDNAV": "",
  "ISABNORMAL": "true",
  "DataConstraintType": "0",
  "gToken": "ceaf-236567466abfda4e2864831ea5645231",
  "ESTABDATE": "6",
  "deviceid": "4a69e1fc7d583fe671ad69c95ae6c2b7||945235770232353",
   "LevelOne": "ddd",
   "LevelTwo": "rty",
}

def CheckDiff():
    dict3=dict1.items() ^ dict2.items()          #对比字典差异，直接展示
    print(dict3)
    dictp={}
    for i in dict3:
        lp=i[0]
        if lp in dictp:
            print('仅值差异，相同的键{}，dict1的值：{}，dict2的值：{}'.format(lp,dict1[lp],dict2[lp]))
            dictp.pop(lp)
        else:
            dictp.update({lp:i[1]})
    print('不存在对方字典的值键：{}'.format(dictp))

if __name__ == '__main__':
    CheckDiff()
